import React from 'react';
import cn from 'classnames';

import topImg from '@/assets/hire/illu01.png';
import styles from './Confirm.less';
import useHireConfirm from '../hooks/useHireConfirm';
import { PageWrap } from './components';

export default ({ setStatus, companyName, setCompanyName, location, setOfferEffectiveValue }) => {
    const employId = location?.query?.employId;
    const { infoData, handleReject, handleAccept } = useHireConfirm({
        setOfferEffectiveValue,
        setStatus,
        employId,
        setCompanyName,
        agree: true
    });
    return (
        <PageWrap>
            <div className={styles.page}>
                <div className={styles.top}>
                    <div className={styles.topTitle}>
                        <p>欢迎加入</p>
                        <p>
                            <strong>{`${companyName || ''}`}</strong>
                        </p>
                        <p>
                            请确认您的<strong>录用</strong>信息
                        </p>
                    </div>
                    <div className={styles.topImg}>
                        <img src={topImg} alt="" />
                    </div>
                </div>
                <div className={styles.content}>
                    <div dangerouslySetInnerHTML={{ __html: infoData?.templateContent }} />
                </div>
                <div className={styles.bottom}>
                    <button className={styles.button} style={{ marginRight: 16 }} type="button" onClick={handleReject}>
                        拒绝
                    </button>
                    <button
                        className={cn(styles.button, styles.primary)}
                        style={{ marginRight: 16 }}
                        type="button"
                        onClick={handleAccept}
                    >
                        接受
                    </button>
                </div>
            </div>
        </PageWrap>
    );
};
